package com.java1234.rocketmq;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.annotation.SelectorType;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 根据Tag 来消费消息
 *
 * 消费端，通过selectorExpression = "TAG1 || TAG2",selectorType = SelectorType.TAG，指定需要消
 * 费的TAG
 */
@RocketMQMessageListener(topic = "java1234-filter-rocketmq", consumerGroup = "${rocketmq.consumer.group}", selectorExpression = "TAG1 || TAG2", selectorType = SelectorType.TAG)
@Component
public class TagConsumerService implements RocketMQListener<String> {

    @Override
    public void onMessage(String s) {
        System.out.println("消费者：收到消息内容：" + s);
    }
}
